package com.ty.day3;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/24 10:16
 */
public class DateDemo {
    public static void main(String[] args) throws ParseException {
        Date date = new Date();
//        date.setTime(date.getTime());
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        date = sdf.parse("2010-10-03");
        System.out.println(sdf.format(date));
        sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        date = sdf.parse("2020-10-10 11:20:30");
        System.out.println(sdf.format(date));
    }
}
